/*
 * @Author: your name
 * @Date: 2021-12-08 22:11:02
 * @LastEditTime: 2021-12-08 22:26:01
 * @Descripttion: 描述
 */
#include "item.h"
#include "gui_engine.h"
Item::Item()
{
    Init();
}
void Item::Init()
{
    valueInt = 0;
    min = 0;
    max = 30000;
    isInvolved = false;
    onAndOff = false;
    hidden = false;
    enterItem = false;
}
void Item::SetTrText(std::string value)
{
    trText = value;
}
std::string Item::GetTrText()
{
    char *string = nullptr;
    GuiEngine::GetInstance().LocaleInfoTr(trText.c_str(), &string);
    if (!string)
    {
        LOG_E("can't find any tr text\n");
        return "nullptr";
    }
    return string;
}
std::string Item::GetStringSend(){
    char *string = nullptr;
    GuiEngine::GetInstance().LocaleInfoTr(trText.c_str(), &string);
    if (!string)
    {
        LOG_E("can't find any tr text\n");
        return "nullptr";
    }
    return string; 
}

void Item::SetText(std::string value)
{
    text = value;
}
std::string Item::GetText()
{
    return text;
}
void Item::SetValueStyle(std::string value)
{
    style = value;
}
std::string Item::GetValueStyle()
{
    return style;
}
void Item::SetValueInt(unsigned int value)
{
    if (value >= min && value <= max)
    {
        valueInt = value;
    }
    else
    {
        LOG_W("out of range\n");
    }
}
unsigned int Item::GetValueInt()
{
    return valueInt;
}
std::string Item::GetString()
{
    return text;
}
std::string Item::GetStringTrText()
{
    return valueTrText;
}
void Item::SetStringTrText(std::string trText)
{
    valueTrText = trText;
}
void Item::SetIsInvolved(bool value)
{
    isInvolved = value;
}
bool Item::GetIsInvolved()
{
    return isInvolved;
}
void Item::SetRange(unsigned int minInt, unsigned int maxInt)
{
    min = minInt;
    max = maxInt;
}
unsigned int Item::GetMinValueInt()
{
    return min;
}
unsigned int Item::GetMaxValueInt()
{
    return max;
}
void Item::SetOnAndOff(bool value)
{
    onAndOff = value;
}
bool Item::GetOnAndOff()
{
    return onAndOff;
}
void Item::SetHidden(bool value)
{
    hidden = value;
}
bool Item::GetHidden()
{
    return hidden;
}
void Item::SetEnterItem(bool value)
{
    enterItem = value;
}
bool Item::GetEnterItem()
{
    return enterItem;
}